import Vue from 'vue'
import ConfirmModal from './ConfirmModal.vue'

let ConfirmModalComponent = Vue.extend(ConfirmModal)

export default function (title, message, confirmText, cancelText, width, disableEscClose, staticModal, showClose, isHtml, maxContentHeight = null) {
  let vm = new ConfirmModalComponent()
  vm.title = title
  vm.text = message
  vm.isHtml = isHtml
  if (maxContentHeight) {
    vm.maxContentHeight = maxContentHeight
  }
  if (width) {
    vm.width = width
  }
  if (disableEscClose !== undefined) {
    vm.disableEscClose = disableEscClose
  }
  if (staticModal !== undefined) {
    vm.staticModal = staticModal
  }
  if (showClose !== undefined) {
    vm.showClose = showClose
  }
  if (confirmText !== undefined && confirmText !== null) {
    vm.confirmText = confirmText
  }
  if (cancelText !== undefined && cancelText !== null) {
    vm.cancelText = cancelText
  }
  vm.$mount()
  document.body.appendChild(vm.$el)
  return vm.open()
}
